#ifndef SIMPLEUPDATE_H
#define SIMPLEUPDATE_H

#pragma once

#include <QObject>
#include <QNetworkReply>

namespace ns_yht
{
    struct ModelRiskArea;

#define SIMPLEUPDATE SimpleUpdate::instance()

    class SimpleUpdate : public QObject
    {
        Q_OBJECT
    public:
        ~SimpleUpdate();

        static SimpleUpdate *instance();

        void startRiskArea();
        void setShipType(int shipType);

    private slots:
        void onUpdateLogFinished(QNetworkReply *reply);
        void requestRiskAreaFinished(QNetworkReply *reply);

    signals:
        void updateFinished(bool succeed);

    private:
        SimpleUpdate();

        void setModelArray(QVector<ModelRiskArea> &riskAreas, int atype, const QJsonArray &array);

        QString m_code;
        QString m_name;
        void postUpdateLog(int result);

        int m_shipType{1};
    };

}
#endif
